Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Fixes temporaryIdMap.get is not a function error in update_project by simplifying the handler architecture so all handlers work uniformly.

Root Cause

The original implementation had project handlers receiving different parameters than regular handlers, creating unnecessary complexity. The reviewer correctly identified that all handlers should work with resolvedTemporaryIds (plain object).

Changes

  • Unified handler signature: All handlers (project and regular) now receive (message, resolvedTemporaryIds) - no special Map parameter
  • Removed special cases: Eliminated isProjectHandler tracking and conditional branching
  • Simplified retry logic: All deferred messages are retried with the same parameter pattern
  • Backward compatibility: Made internal functions support both Map and plain object during transition
  • Updated tests: Removed expectations of Map mutation since handlers return temporary ID mappings instead
// Before: Project handlers received special treatment
if (isProjectHandler) {
  result = await messageHandler(message, temporaryIdMap, resolvedTemporaryIds);
} else {
  result = await messageHandler(message, resolvedTemporaryIds);
}

// After: All handlers receive the same parameters
result = await messageHandler(message, resolvedTemporaryIds);

Result

  • ✅ Cleaner, more maintainable architecture with no special cases
  • ✅ All handlers read from resolvedTemporaryIds and return temporary ID mappings
  • ✅ Unified handler manager treats all message types consistently
  • ✅ All 3,400 JavaScript tests pass

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 8, 2026 08:52
When deferred messages are retried, project handlers (update_project, create_project, etc.)
were being called with incorrect parameters. Project handlers expect 3 parameters:
(message, temporaryIdMap, resolvedTemporaryIds) but the retry logic only passed 2 parameters,
causing temporaryIdMap to receive a plain object instead of a Map.

Changes:
- Store isProjectHandler flag when deferring messages
- Check isProjectHandler during retry and pass correct parameters
- Add project handler result handling during retry (project URLs and draft items)
- Update JSDoc for deferredMessages type

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix errors from run related to update_project Fix deferred project handler parameter mismatch Feb 8, 2026
Copilot AI requested a review from mnkiefer February 8, 2026 09:01
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 8, 2026

@copilot Draft issue items should also work with resolvedTemporaryIds. There should be no need for an extra case of the handler

Project handlers no longer need the Map parameter - they only receive resolvedTemporaryIds (plain object).
This simplifies the handler signature and removes the special case for project handlers in the unified manager.

Changes:
- Updated handler signatures to only accept (message, resolvedTemporaryIds)
- Removed isProjectHandler tracking in deferred messages
- Simplified retry logic to treat all handlers uniformly
- Updated resolveIssueNumber to support both Map and plain object for backward compatibility
- Updated internal updateProject function to support both Map and object
- Updated tests to not expect Map mutation

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot Draft issue items should also work with resolvedTemporaryIds. There should be no need for an extra case of the handler

You're absolutely right! I've simplified the architecture so all handlers (both project and regular) work the same way:

  • All handlers now receive (message, resolvedTemporaryIds) - no special Map parameter for project handlers
  • Handlers read from resolvedTemporaryIds (plain object) and return temporary ID mappings
  • The unified handler manager treats all handlers uniformly - no more isProjectHandler branching

This makes the code cleaner and removes the unnecessary special case. All 3400 tests pass. (commit e7d00e7)

Copilot AI changed the title Fix deferred project handler parameter mismatch Simplify safe output handler architecture - remove special case for project handlers Feb 8, 2026
@mnkiefer mnkiefer closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants